package cn.hanyx.vlog.videoservice.service;

import cn.hanyx.vlog.videoservice.entity.Video;
import cn.hanyx.vlog.videoservice.mapper.VideoMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * VideoService
 *
 * @author hanyx
 * @date 2021/11/04
 */
@Slf4j
@Service
public class VideoService {

    @Resource
    private VideoMapper videoMapper;

    @Trace
    @Tags({@Tag(key = "param", value = "arg[0]"),
            @Tag(key = "video", value = "returnedObj")})
    public Video findByArticleId(Long articleId) {
        log.info("articleId： " + articleId);
        return videoMapper.findByArticleId(articleId);
    }
}
